
package org.rescue.search;

import java.util.*;

import org.rescue.data.extraction.AnnotationSet;
import org.rescue.data.extraction.Location;

/** 
 * Document - contains the information representing single result document in a dataset.
 * 
 * @author Jay Lickfett
 */
public class Document {
	
	private String contents;	
	private String title;
	private String url;
	//private ArrayList<Integer> concepts = new ArrayList<Integer>();
	private ArrayList<Location> locations = new ArrayList<Location>(0);
	private int id;
	
	private ArrayList<AnnotationSet> annotationSets = new ArrayList<AnnotationSet>();
	
	
	public void addAnnotationSet(AnnotationSet annotationSet) {
		annotationSets.add(annotationSet);
	}
	public ArrayList<AnnotationSet> getAnnotationSets(){
		return annotationSets;
	}
	
	
	public void addLocation(String locationName, String locationType) {
		locations.add(new Location(locationName, locationType));
	}
	
	public ArrayList<Location> getLocations() {
		return locations;
	}
	
	public Document() {
		
	}

	public Document(int id, String url, String title, String contents) {
		this.id = id;
		this.url = url;
		this.title = title;
		this.contents = contents;
	}
	
	public Document(String url, String title, String contents) {
		this.url = url;
		this.title = title;
		this.contents = contents;
	}
	
	public int getId() {
		return id;
	}
	
	public void setId(int id) {
		this.id = id;
	}
	
	public String getContents() {
		return contents;
	}
	
	public void setContents(String c) {
		contents = c;
	}
	
	public String getTitle() {
		return title;	
	}
	
	public void setTitle(String t) {
		title = t;	
	}
	
	public void setURL(String u) {
		url = u;	
	}
	
	public String getURL() {
		return url;	
	}
	
	/*public void addConcept(int id) {
		concepts.add(id);
	}
	
	public ArrayList<Integer> getConcepts() {
		return concepts;
	}*/
	
	public String toString() {
		String s = title + " \n\t" + url + "\n" ;//+ contents + "\n\n";
		//s += "conceptIds: ";
		/*for (Integer concept : concepts) {
			s += "\t" + concept;
		}*/
		s += "locations from GATE:\n";
		for (Location location : locations) {
			s += "\t" + location;
		}
		s += "concept sets: \n";
		for (AnnotationSet as : annotationSets) {
			s += "{";
			for (Integer annotationId : as.getAnnotationIds()) {
				s+= annotationId + ",";
			}
			s+="}";
		}
		return s;	
	}
}